package entity

import (
	"database/sql"

	"github.com/lab-online/internal/shared/entity"
	"github.com/lab-online/pkg/auth"
)

type User struct {
	entity.Base
	Username string `json:"username"`
	Name     string `json:"name"`
	Password string `json:"password"`
	Role     uint8  `json:"role"`
}

type UserEntityGetter interface {
	GetID() uint
	GetUsername() string
	GetName() string
	GetPassword() string
	GetRole() uint8
	GetDeletedAt() sql.NullTime
}

type UserEntityJudgeRole interface {
	Update(opts ...UserOption)
	CanHandleUser(authEntity auth.AuthEntity, readOnly bool) bool
	IsStudent() bool
	IsTeacher() bool
	IsAdmin() bool
}

type UserEntity interface {
	UserEntityGetter
	UserEntityJudgeRole

	HashPassword() error
	ComparePassword(password string) bool
}
